<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.jsdelivr.net/npm/vue@2.6.12"></script>
</head>
<body>

<div id="app">
    <p>currentTime1 {{currentTime1()}}</p>
    <p>currentTime2 {{currentTime2}}</p>
    
</div>


<script>
    var vm = new Vue({//
        el: "#app",
        data: {message:"123"},
        methods: {
            currentTime1: function(){
                return Date.now();
            }
        },
        computed:{//methods 与 computed 建议不要重名，否则只会调用methods中的方法
            currentTime2: function(){
                this.message;//除非有增删改，否则不会重新计算（类似缓存）
                return Date.now();
                //不能调用currentTime2()
            }            
        }
    })
</script>


</body>
</html>